<template>
	<view>
		<cu-custom :showBack="false"/>
		<view class="image-content d-flex flex-row pt-2 pb-2 bgcolor j-sb">
			<view class="d-flex flex-row">
				<image class="mr-2" style="width: 120rpx; height: 120rpx; background-color: #eeeeee; border-radius: 100%;"
					mode="scaleToFill" :src="src"></image>
				<view class="d-flex flex-column j-sa">
					<text>{{supplier_name}}</text>
					<text>{{supplier_mobile}}</text>
				</view>
			</view>
			<view class="d-flex flex-column j-sa text-right">
				<text>余额</text>
				<text class="main-text-color font-lg" v-if="supplier_money">￥{{supplier_money}}</text>
			</view>
			
		</view>
		<view class="mune-box">
			<view class="rank-box">
				<image :src="`${getApp.globalData.baseImgUrl}/image/45@2x.png`" style="height: 100%; height: 573rpx;" mode="" class="my-bg">
				</image>
				<view class="rank-item">
					<view class="item-title">排行榜</view>
					<view class="item-value">当前排名 <text class="ml-1">{{supplier_rank == 0? '--': supplier_rank}}</text></view>
				</view>
			</view>
			<view class="menu-item mt-5">
				<view class="item span-20 d-flex flex-row j-sb a-center" @click="navigatorTo(0)">
					<image :src="`${getApp.globalData.baseImgUrl}/image/icon/24@2x.png`" style="width: 54rpx; height: 54rpx;" mode=""></image>
					<view class="d-flex flex-1 flex-row a-center j-sb ml-1" style="height: 100%;">
						<text class="font-md">商品管理</text>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="item span-20 d-flex flex-row j-sb a-center" @click="navigatorTo(1)">
					<image :src="`${getApp.globalData.baseImgUrl}/image/icon/19@2x.png`" style="width: 54rpx; height: 54rpx;" mode=""></image>
					<view class="d-flex flex-1 flex-row a-center j-sb ml-1" style="height: 100%;">
						<text class="font-md">订单管理</text>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="item span-20 d-flex flex-row j-sb a-center" @click="navigatorTo(2)">
					<image :src="`${getApp.globalData.baseImgUrl}/image/icon/19@2x.png`" style="width: 54rpx; height: 54rpx;" mode=""></image>
					<view class="d-flex flex-1 flex-row a-center j-sb ml-1" style="height: 100%;">
						<text class="font-md">价格指数</text>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="item span-20 d-flex flex-row j-sb a-center" @click="navigatorTo(7)">
					<image :src="`${getApp.globalData.baseImgUrl}/image/icon/17@2x.png`" style="width: 54rpx; height: 54rpx;" mode=""></image>
					<view class="d-flex flex-1 flex-row a-center j-sb ml-1" style="height: 100%;">
						<text class="font-md ml-1">店铺设置</text>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="item span-20 d-flex flex-row j-sb a-center" @click="navigatorTo(4)">
					<image :src="`${getApp.globalData.baseImgUrl}/image/icon/25@2x.png`" style="width: 54rpx; height: 54rpx;" mode=""></image>
					<view class="d-flex flex-1 flex-row a-center j-sb ml-1" style="height: 100%;">
						<text class="font-md ml-1">活动申请</text>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="item span-20 d-flex flex-row j-sb a-center" @click="navigatorTo(99)">
					<image :src="`${getApp.globalData.baseImgUrl}/image/icon/kuaidi.png`" style="width: 54rpx; height: 54rpx;" mode=""></image>
					<view class="d-flex flex-1 flex-row a-center j-sb ml-1" style="height: 100%;">
						<text class="font-md ml-1">快递商城</text>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="item span-20 d-flex flex-row j-sb a-center" @click="navigatorTo(99)">
					<image :src="`${getApp.globalData.baseImgUrl}/image/icon/wuliu.png`" style="width: 54rpx; height: 54rpx;" mode=""></image>
					<view class="d-flex flex-1 flex-row a-center j-sb ml-1" style="height: 100%;">
						<text class="font-md ml-1">物流商城</text>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="item span-20 d-flex flex-row j-sb a-center" @click="navigatorTo(99)">
					<image :src="`${getApp.globalData.baseImgUrl}/image/icon/daikuan.png`" style="width: 54rpx; height: 54rpx;" mode=""></image>
					<view class="d-flex flex-1 flex-row a-center j-sb ml-1" style="height: 100%;">
						<text class="font-md ml-1">贷款服务</text>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="item span-20 d-flex flex-row j-sb a-center" @click="navigatorTo(10)">
					<image :src="`${getApp.globalData.baseImgUrl}/image/icon/xieyi.png`" style="width: 54rpx; height: 48rpx;" mode=""></image>
					<view class="d-flex flex-1 flex-row a-center j-sb ml-1" style="height: 100%;">
						<text class="font-md ml-1">用户协议</text>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="item span-20 d-flex flex-row j-sb a-center">
					<image :src="`${getApp.globalData.baseImgUrl}/image/icon/customerService.png`" style="width: 54rpx; height: 54rpx;" mode=""></image>
					<view class="d-flex flex-1 flex-row a-center j-sb ml-1" style="height: 100%;">
						<button type="default" open-type="contact" class="font-md ml-1 p-0">联系客服</button>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</view>
			<view class="menu-item">
				<view class="item span-20 d-flex flex-row j-sb a-center"  @click="navigatorTo(11)">
					<image :src="`${getApp.globalData.baseImgUrl}/image/icon/11@11.png`" style="width: 54rpx; height: 54rpx;" mode=""></image>
					<view class="d-flex flex-1 flex-row a-center j-sb ml-1" style="height: 100%;">
						<text class="font-md ml-1">财务系统信息管理</text>
						<view class="iconfont icon-youjiantou"></view>
					</view>
				</view>
			</view>
		</view>
		<view class=" p-2 mt-4">
			<button type="default" @click="logout" class="border font-md">退出登录</button>
		</view>
	</view>
</template>

<script>
	import divider from "@/components/common/divider.vue"
	import cuCustom from '@/components/common/custom.vue'
	import interceptor from "@/utils/request.js"
	export default {
		components: {
			divider,
			cuCustom
		},
		data() {
			return {
				supplier_name:"",
				supplier_mobile:"",
				src: "",
				supplier_money:"",
				supplier_rank:null,
				getApp:""
			};
		},
		created() {
			this.getApp = getApp()
		},
		onShow() {
			this.getStoreBase()
		},
		methods: {
			navigatorTo(index) {
				if(index == 99){
					uni.showToast({
						title:"暂未开放! 敬请期待",
						icon:"none"
					})
				}else {
					let urlList = [
						"../shop/index",
						"../order/index",
						"../price/index",
						"../../pagesPackage/minePackage/rechargeCenter/rechargeCenter",
						"../../pagesPackage/minePackage/activeCenter/index",
						"",
						"",
						"../storeSetting/index",
						"",
						"",
						"./settlemrnt",
						"../../pagesPackage/minePackage/erp/index"
					]
					uni.navigateTo({
						url: urlList[index]
					})
				}
				
			},
			// 获取详情
			getStoreBase() {
				let params = {
					supplier_id: uni.getStorageSync("supplier_id"),
					user_id: uni.getStorageSync("USER_ID")
				}
				interceptor.get("/supplier_applet_api.php?act=userInfo", params).then((res) => {
					if (res.status == 1) {
						
						this.supplier_name = res.info.supplier.company_name
						this.supplier_money = res.info.supplier.supplier_money
						this.supplier_mobile = res.info.user.mobile_phone
						this.confirmNumber = res.info.user.confirm
						this.supplier_rank = res.info.supplier.supplier_rank
						this.src = this.returnImg(res.info.supplier.value)
						uni.setStorageSync('CONFIRM_NUMBER',this.confirmNumber)

						this.$forceUpdate()
					} else {
						uni.showToast({
							title: res.msg,
							icon: "none"
						})
					}
				})
			},
			returnImg(img) {
				return `${getApp().globalData.baseUrl}/${img}`
			},
			logout(){
				uni.clearStorageSync()
				uni.reLaunch({
					url: '/pagesPackage/minePackage/login/login'
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.image-content {
		padding: 20rpx 46rpx;
	}

	.bgcolor {
		background: linear-gradient(0deg, rgba(235, 236, 237, .3), #F4E3E2);
	}

	.mune-box {
		width: 100%;
		height: auto;
		position: relative;

		.rank-box {
			position: relative;
			height: 210rpx;

			.my-bg {
				position: absolute;
				top: -34rpx;
				z-index: -1;
			}

			.rank-item {
				padding-left: 110rpx;
				padding-top: 60rpx;
				box-sizing: border-box;

				.item-title {
					font-weight: 400;
					font-size: 44rpx;
					color: #FFFFFF;
				}

				.item-value {
					font-weight: bold;
					font-size: 30rpx;
					color: #FFFFFF;
				}
			}
		}


		.menu-item {
			width: 100%;
			box-sizing: border-box;
			height: 100upx;
			padding: 0 46rpx;
			.item {
				height: 100%;
			}
		}
		.menu-grid{
			width: 100%;
			box-sizing: border-box;
			height: auto;
			padding: 0 46rpx;
			flex-wrap: wrap;
			.grid-item{
				width: 320rpx;
				height: 260rpx;
				background: #FFFFFF;
				border-radius: 19rpx;
				padding: 20rpx 15rpx;
				box-sizing: border-box;
				.grid-title{
					font-weight: 400;
					font-size: 24rpx;
					color: #333333;
				}
			}
		}
	}
</style>